import type { RouteRecordRaw } from 'vue-router';
/**
 * 路由meta对象参数说明
 * meta: {
 *      title:          菜单栏及 tagsView 栏、菜单搜索名称（国际化）
 *      hidden：        是否隐藏此路由
 *      icon：          菜单、tagsView 图标，阿里：加 `iconfont xxx`，fontawesome：加 `fa xxx`
 * }
 */

/**
 * 静态路由（默认路由）
 */
 export const staticRoutes: Array<RouteRecordRaw> = [
	{
    path: '/login',
    name: 'Login',
    component: () => import('@/views/login/index.vue'),
    meta: {
      hidden: true
    }
  },

  {
    path: '/404',
    name: '404',
    component: () => import('@/views/error/404.vue'),
    meta: {
      hidden: true
    }
  },

  {
    path: '/',
    component: () => import('@/layout/index.vue'),
    redirect: '/home',
    children: [{
      path: 'home',
      name: 'Home',
      component: () => import('@/views/home/index.vue'),
      meta: { 
        title: '首页', 
        icon: 'ele-HomeFilled', 
      },
    },
  ],
  },
  // /* 匹配任意的路由 必须最后注册 */
  // {
  //   path: "/:pathMatch(.*)",
  //   name: "Any",
  //   redirect: "/404",
  //   meta: {
  //     hidden: true,
  //   },
  // },
];

/* 
定义动态路由（除了静态路由和任意路由，其他所有的路由都放在动态路由中，我们根据用户登录后返回的routes权限数据，决定把哪些路由放在静态路由中）
*/
export const allAsyncRoutes: Array<RouteRecordRaw> =[
    /* 权限管理路由 start */
  {
    path: "/acl",
    name: "Acl",
    component: () => import("@/layout/index.vue"),
    redirect: "/acl/user/list",
    meta: {
      title: "权限管理",
      icon: "ele-Setting",
    },
    children: [
      {
        name: "User",
        path: "/acl/user/list",
        component: () => import("@/views/acl/user/index.vue"),
        meta: {
          title: "用户管理",
        },
      },
      {
        name: "Role",
        path: "/acl/role/list",
        component: () => import("@/views/acl/role/index.vue"),
        meta: {
          title: "角色管理",
        },
      },
      {
        name: "RoleAuth",
        path: "/acl/role/auth",
        component: () => import("@/views/acl/role/roleAuth.vue"),
        meta: {
          title: "角色管理",
          hidden: true,
          activeMenu: "/acl/role/list",
        },
      },
      {
        name: "Permission",
        path: "/acl/permission/list",
        component: () => import("@/views/acl/permission/index.vue"),
        meta: {
          title: "菜单管理",
        },
      },
    ],
  },

  // 侧边栏的一级标题生成是遍历一级路由得来的，所以商品管理要配为一级路由
  {
    path:"/product",
    name: "Product",
    component:()=> import("@/layout/index.vue"),
    meta: {
      title:"商品管理",
      //这个是小图标
      icon: "ele-Goods",
    },
    children:[
      {//这个是二级路由不是三级，只不过是匿名了而已
        path:"trademark/list",
        name:"Trademark",
        component:()=>import("@/views/Product/Trademark/index.vue"),
        meta:{
          title:"品牌管理",
        },
      },
      {//这个是二级路由不是三级，只不过是匿名了而已
        path:"attr/list",
        name:"Attr",
        component:()=>import("@/views/Product/Attr/index.vue"),
        meta:{
          title:"平台属性管理",
        },
      },
      {//这个是二级路由不是三级，只不过是匿名了而已
        path:"sku/list",
        name:"Sku",
        component:()=>import("@/views/Product/Sku/index.vue"),
        meta:{
          title:"Sku管理",
        },
      },
      {//这个是二级路由不是三级，只不过是匿名了而已
        path:"spu/list",
        name:"Spu",
        component:()=>import("@/views/Product/Spu/index.vue"),
        meta:{
          title:"Spu管理",
        },
      },
    ]
  },
  {
    path: "/laowen",
    name: "Laowen",
    component: () => import("@/layout/index.vue"),
    meta: {
      title: "文文的测试",
      icon: "ele-Edit",
    },
    children: [
      {
        path: "test1",
        name: "test1",
        component: () => import("@/views/laowen/test1/index.vue"),
        meta: {
          title: "测试1",
        },
      },
      {
        path: "test2",
        name: "test2",
        component: () => import("@/views/laowen/test2/index.vue"),
        meta: {
          title: "测试2",
        },
      },
    ],
  },
];

/* 
  定义一个任意路由(必须放在最后边,当用户输入的内容不符合其他路由条件的的时候,进入任意路由)
*/
export const anyRoute: RouteRecordRaw = {
  path: "/:pathMatch(.*)",
  name: "Any",
  redirect: "/404",
  meta: {
    hidden: true,
  },
};




